package com.hello.tong.controller;

import com.hello.tong.service.IBusinessService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tong-exists
 * @Create 2022/12/30 18:48
 * @Version 1.0
 */
@RestController
public class BusinessController {

    @Autowired
    private IBusinessService businessService;

    @PostMapping("/purchase/{userId}/{commodityCode}/{orderCount}")
//    @GlobalTransactional
    public void purchase(@PathVariable("userId") String userId,
                         @PathVariable("commodityCode") String commodityCode,
                         @PathVariable("orderCount") int orderCount) {
        businessService.purchase(userId, commodityCode, orderCount);
    }

}
